home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / misc / linuxupg.000 / linuxupg / upgrade / Install.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1995-03-23  |  3.4 KB  |  161 lines

  1. #! /bin/sh
  2. #
  3. # NET-BASE    A collection of programs that form the base set of the
  4. #        NET-2 Networking Distribution for the LINUX operating
  5. #        system.
  6. #
  7. # Usage:    Install.sh [--devices] [--firsttime] [--nobackup]
  8. #
  9. # Version:    @(#)Install.sh  1.62    01/20/94
  10. #
  11. # Authors:    Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
  12. #        Johannes Grosen, <grosen@argv.cs.ndsu.nodak.edu>
  13. #        Copyright 1988-1993 MicroWalt Corporation
  14. #
  15. #        This program is free software; you can redistribute it
  16. #        and/or  modify it under  the terms of  the GNU General
  17. #        Public  License as  published  by  the  Free  Software
  18. #        Foundation;  either  version 2 of the License, or  (at
  19. #        your option) any later version.
  20. #
  21. PATH=/bin:/usr/bin:/sbin:/usr/sbin
  22. export PATH
  23. NROFF="groff -Tascii"    # how to format man pages for catman
  24.  
  25. BIN_PROGS="hostname netstat dnsdomainname"
  26. SBIN_PROGS="arp ifconfig rarp route slattach ipfw"
  27.  
  28.   backup()
  29.   {
  30.     if [ "${nobackup}" = "NO" ]; then
  31.         if [ -s $1 ]; then
  32.             mv $1 $1.old
  33.         fi
  34.     fi
  35.   }
  36.  
  37.   # Display a prompt, and then ask for Y or N.
  38.   yesno() \
  39.   {
  40.     if [ $# = 0 ]; then
  41.         prompt="Are you sure? (y/n): "
  42.       else
  43.         prompt="$*: "
  44.     fi
  45.     while true
  46.     do
  47.         echo -n ${prompt}
  48.         read answer
  49.         if [ -n "${answer}" -a \
  50.              "${answer}" = "y" -o "${answer}" = "Y" -o \
  51.              "${answer}" = "n" -o "${answer}" = "N" ]; then
  52.             break
  53.         fi
  54.         echo "***** WRONG ANSWER!"
  55.     done
  56.     if [ "${answer}" != "y" -a "${answer}" != "Y" ]; then
  57.         return 1
  58.       else
  59.         return 0
  60.     fi
  61.   }
  62.  
  63.  
  64.   nobackup=NO
  65.   while [ $# != 0 ]; do
  66.     case $1 in
  67.         --nobackup)
  68.             nobackup="YES"
  69.             shift
  70.             ;;
  71.  
  72.         -*)
  73.             echo "Usage: Install.sh [--nobackup]" >&2
  74.             exit 1
  75.             ;;
  76.  
  77.         *)
  78.             shift
  79.             ;;
  80.     esac
  81.   done
  82.   echo
  83.   echo "This procedure will install the NET-3 Base Utilities for you."
  84.  
  85.   ETC="/etc"
  86.   SBIN="/sbin"
  87.   CONF="/etc"
  88.   DOLINK=0
  89.   DIRS="/dev /sbin /etc /bin /usr /usr/bin /usr/man"
  90.  
  91.  
  92.   # Are we expected to install preformatted manual pages?
  93.   CATMAN=0
  94.   if [ -d /usr/man/cat1 ]; then
  95.     echo
  96.     if yesno "Do you want me to pre-format the manual pages? (y/n)"; then
  97.         CATMAN=1
  98.     fi
  99.   fi
  100.  
  101.   # Install the primary user commands.
  102.   echo ; echo "Installing USER commands:"
  103.   for i in ${BIN_PROGS}
  104.   do
  105.     path=/bin/`basename $i`
  106.     echo -n "${path} "
  107.     backup ${path}
  108.     cp $i ${path}
  109.     chmod 511 ${path}
  110.     chown bin.bin ${path}
  111.   done
  112.   (echo -n "/bin/dnsdomainname"; cd /bin; ln -f hostname dnsdomainname ; echo)
  113.  
  114.   # Install the primary system administrator commands.
  115.   echo ; echo "Installing SYSTEM administrator commands:"
  116.   for i in ${SBIN_PROGS}
  117.   do
  118.     path=${SBIN}/`basename $i`
  119.     echo -n "${path} "
  120.     backup ${path}
  121.     cp $i ${path}
  122.     chmod 500 ${path}
  123.     chown bin.bin ${path}
  124.   done
  125.   echo
  126.  
  127.   # Install the manual pages.
  128.   echo ; echo -n "Installing manual pages..."
  129.   for i in 1 5 8
  130.   do
  131.     # Install manual sources.
  132.     chmod 644 man/*.$i
  133.     chown bin.bin man/*.$i
  134.     cp -af man/*.$i /usr/man/man$i >/dev/null
  135.  
  136.     # Do we need to pre-format them as well?
  137.     if [ ${CATMAN} -eq 1 ]; then
  138.         for manpage in man/*.$i
  139.         do
  140.             page=`basename ${manpage}`
  141.             rm -f /usr/man/cat${i}/${page}
  142.             ${NROFF} -man $manpage > /usr/man/cat${i}/${page}
  143.             chmod 644 /usr/man/cat${i}/${page}
  144.             chown bin.bin /usr/man/cat${i}/${page}
  145.         done
  146.     fi
  147.   done
  148.   (cd /usr/man/man1; ln -sf hostname.1 domainname.1)
  149.   echo
  150.  
  151.   echo ; echo "Installation completed."
  152.   if [ "${nobackup}" = "NO" ]; then
  153.     echo
  154.     echo "Your old binaries (if they existed) were backed up to <name>.old."
  155.     echo "You may safely delete them once you are satisfied that the new"
  156.     echo "setup is working correctly."
  157.   fi
  158.   echo
  159.  
  160.   exit 0
  161.